@extends('layouts.app')
@section('content')
    <section class="content-header">
        <h1>
            登山
            <small>奖品列表</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="/dashboard"><i class="fa fa-dashboard"></i>家</a></li>
            <li><a href="#">登山</a></li>
            <li class="active">奖品列表</li>
        </ol>

    </section>

    <section class="content-header">

        @if (Session::has('mgssages'))
            <div class="alert alert-success alert-dismissible">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <h4><i class="icon fa fa-check"></i> 状态!</h4>
                <ul>
                    @foreach (Session::get('mgssages') as $message)
                        <li>{{ $message }}</li>
                    @endforeach
                </ul>
            </div>
        @endif
    </section>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">搜索</h3>
                            <div class="box-tools"></div>
                        </div>
                        <div class="box-body">
                            <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                                <form class="form-inline" role="form" method="get" id="frmSearch">
                                    <div class="form-group">
                                        <input class="form-control type form-inline" name="nickname" placeholder="请输入用户名">
                                    </div>&nbsp;
                                    <input type="submit" class="btn  btn-success" value="搜索">&nbsp;
                                    <input type="reset" class="btn  btn-primary" value="重置搜索条件">
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">奖品列表</h3>
                        <div class="box-tools">
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
                            <div class="row">
                                <div class="col-sm-6"></div>
                                <div class="col-sm-6"></div>
                            </div>
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="example2" class="table table-bordered table-hover dataTable"
                                           role="grid" aria-describedby="example2_info">
                                        <thead>
                                        <tr role="row">
                                            <th>编号
                                            </th>
                                            <th>
                                                用户名
                                            </th>
                                            <th>
                                                奖品
                                            </th>
                                            <th>
                                                是否兑换
                                            </th>
                                            <th>
                                                中奖时间
                                            </th>
                                        </tr>
                                        </thead>
                                        <?php $i=1;?>
                                        <tbody>
                                        @if(count($data)>0)@foreach($data as $val)
                                            <tr role="row" class="even">
                                                <td class="sorting_1">{{$i++}}</td>
                                                <td>{{$val->nickname}}</td>
                                                <td>@if($val->awardid ==1)一等奖
                                                    @elseif($val->awardid ==2)二等奖
                                                    @elseif($val->awardid ==3)三等奖
                                                    @else四等奖
                                                    @endif
                                                </td>
                                                <td>@if($val->iswin ==1)已兑换@else未兑换@endif</td>
                                                <td>{{$val->created_at}}</td>
                                            </tr>
                                        @endforeach @endif
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            @include("layouts.page",['paginator'=>$data])
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- Modal -->
    <style>
        a{cursor: pointer;}
        .panel{ margin-left: 15px; margin-right: 15px;}
    </style>

    <script>
        if($(".alert").css("display","block")){
            setTimeout(function(){
                $(".alert").alert('close');
            }, 3000);
        }
        var search = location.search.substring(1);
        if (search) {
            try {
                var query = JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');

                $.each(query, function(k, v) {
                    $('[name=' + k + ']').val(v);
                });
            } catch (e) {
                console.log(e);
            }

        }


    </script>
@endsection